package NewCoder;

public class BM78 {
    public int rob (int[] nums) {
        // write code here
        int[] dp=new int[nums.length+2];
        for(int i=nums.length-1;i>=0;i--){
            dp[i]=Math.max(dp[i+1],nums[i]+dp[i+2]);
        }
        return dp[0];
    }
}
